<?php
	die("DEPRECATED BOOOHHHYAAAAH");

	include_once("cmsConfig.php");
	include_once("lib/CmsWriter.php");


	//global $db;//
	//if we have no form id.. but we do have a documentCode, we can look up the form id.
	//if we dont have a form id after attempting to find one, we throw a hissey fit
	//get the fields y/n
	//otherwise we create the CmsWrite object and tell it to do its thang..
	//all data will only ever be posted.
	//echo "post = <pre>";print_r($_POST);echo "</pre><br>";
	//Set up a return url instead and a default to home
	if(isset($_POST['returnURLEncoded']) && strlen($_POST['returnURLEncoded']) > 0){
		$returnURL = urldecode($_POST['returnURLEncoded']);
	}
	
	if(!isset($_POST['returnURLEncoded']) || strlen($_POST['returnURLEncoded']) == 0){
//		$returnURL = CMS_HOME;// going home is arse.. i am thinking that its better to go back to the document we saved perhaps
		$returnURLEncoded = urlencode($returnURL);
	}
	
	if ($result->hasErrors ) {
//		// we want to redirect to where we came from..
//		//with  with some validation and what not and the data that was added earlier.
//			echo "FAILED TO SAVE DATA.. check error message";
//


		include("cmsMasterAdd.php");
	} else {
		dialoguePage(array(	DLG_MESSAGE=> 	$message,
					DLG_LEFT_TEXT=>	DLG_EMPTY,
					DLG_LEFT_LINK=>	CMS_HOME,
					DLG_RIGHT_TEXT=>	DLG_OK,
					DLG_RIGHT_LINK=>	$returnURL ));
	}
	
	echo "<br/><br/><br/>CMSSTATUS <pre>"; print_r($result); echo "</pre>";	//
	echo "<br/><br/><br/>REQUEST <pre>"; print_r($_REQUEST); echo "</pre>";	//
	echo "SESSION <pre>"; print_r($_SESSION); echo "</pre>";				//



?>